package com.haois.mp.database.util.jx;

public class StringUtil {

	/**
	 * 格式化卡号
	 * 
	 * @param cardNo
	 * @param num 分割间隔
	 * @param splitStr 分割字符
	 * @return
	 */
	public static String formatCardNo(String cardNo, int num, String splitStr) {
		String str = cardNo;
		StringBuilder sb = new StringBuilder(cardNo);
		int length = str.length() / num + str.length();

		for (int i = 0; i < length; i++) {
			if (i % (num + 1) == 0) {
				sb.insert(i, splitStr);
			}
		}
		sb.deleteCharAt(0);
		return sb.toString();
	}
	
}
